<template>
  <section>
    <el-checkbox-group v-model="selItems">
      <el-checkbox v-for="item in items" :key="item.id" :label="item.id">{{item.title}}</el-checkbox>
    </el-checkbox-group>
    <el-pagination mini layout="prev, pager, next" :page-count="totalPage" @current-change="goPage"/>
  </section>
</template>

<script>
  import {mapGetters, mapActions, mapMutations} from 'vuex'
  export default {
    name: "selItem",
    props:['selItems'],
    data(){
      return{
        items:null,
        totalPage:0
      }
    },
    created(){
      this.getItems()
    },
    computed:{
      ...mapGetters(['department']),
    },
    watch: {
    },
    methods: {
      ...mapActions({
        fetch: 'fetch'
      }),
      goPage(val){
        this.getItems(val-1)
      },
      getItems(pageNo){
        this.fetch({name:"getExamineDefineItemList",data:{page:pageNo?pageNo:0,departmentId:this.department.id}})
          .then(res=>{
            console.log('看下定义项列表---------',res)
            this.items=res.content
            this.totalPage=res.totalPages
          })
          .catch(err=>{
            console.log(err)
            errHandler.handle(this,err)
          })
      }
    }
  }
</script>

<style scoped>

</style>
